Managing Terminal Services User Connections
Terminal
Services Manager (TSM) is the main administrative tool used to manage
connections to a terminal server. You can use TSM to view information
about users connected to a terminal server, to monitor user sessions,
or to perform administrative tasks such as logging users off or
disconnecting user sessions.
To
open TSM from the Start menu, point to Administrative Tools, point to
Terminal Services, and then click Terminal Services Manager. You can
also open TSM by typing tsadmin.msc in the Start Search or Run boxes on the Start menu.
The
next section reviews the main management tasks you can perform in TSM
and provides many command-line alternatives for these management tasks.
To learn more about using TSM, be sure to perform the exercises at the
end of this lesson.
TSM is shown in Figure 1.
TSM provides three tabs from which to view and manage Terminal Services connections: Users, Sessions, and Processes.
The
Users tab displays information about users connected to the terminal
server, information such as the currently logged on user accounts, the
time of the user’s logon to the server, and the session status.
To display information about user sessions on a terminal server, you can also use the Query user or Quser command-line commands.
More Info: Use the /? switch for more info
To
learn more about any of the command-line tools introduced in this
section, simply type the command at the command prompt with the /? switch. For example, to learn the syntax for Quser, type quser /?.
The
Sessions tab provides information about the sessions connected to the
terminal server. Because some sessions are initiated by services or by
the operating system, sessions typically outnumber users.
To display information about sessions on a terminal server, you can also use the Query session command.
The Processes tab displays information about which programs each user is running on the terminal server.
To display information about processes that are running on the terminal server, you can also use the Query process or Qprocess command.
Managing User Sessions
To
manage user sessions in TSM, simply right-click a user shown on the
Users tab, and then select any of the seven command options available
on the shortcut menu. Alternatively, you can select a user, and then
click an action available on the Actions menu. Both of these options
are shown in Figure 2.
The
following section describes the seven management options available on
the user session shortcut menu, along with their command-line tool
equivalents.
Connect You can use the Connect
command to reconnect to your own active or disconnected user session.
(This scenario is possible only when you have configured the terminal
server to accept multiple sessions from the same user.) In addition, if
you have been granted the Full Control or Connect special access
permission on the server’s RDP-Tcp connection (configured in the
Terminal Services Configuration console), you can also use this command
to connect to the active or disconnected session of another user.
As an alternative to using TSM to connect to a TS client session, you can also use the Tscon command-line command.
Important: Using the Connect feature in TSM
You
must be connected to the terminal server in a client session to use the
Connect feature in TSM. The feature is disabled in TSM when you are
logged on locally to the terminal server. (A local logon session is
also known as a console session.)
Disconnect You can use the Disconnect
command in the Actions pane or on the shortcut menu to disconnect a
user from a session. When you disconnect a user from a session, all the
programs and processes running in the session continue to run.
Therefore, too many disconnected sessions can drain terminal server
resources and slow server performance.
As an alternative to using TSM to disconnect a TS client session, you can also use the Tsdiscon command-line tool.
Disconnecting
another user from a session requires the Full Control or Disconnect
special access permission on the server’s RDP-Tcp connection.
Send Message The Send Message
command enables you to send a simple console message to a user
connected to a terminal server. Use this command, for example, when you
need to warn a user that he or she is about to be disconnected or
logged off.
To send a message to a user on a terminal server, you can also use the Msg command-line tool.
Sending
a message to another user in Terminal Services requires the Full
Control or Message special access permission on the server’s RDP-Tcp
connection.
Remote Control The Remote Control
command enables you to view or control another user’s TS client
session. (You can configure the behavior of the Remote Control feature
in the Terminal Services Configuration console, the Remote Control tab
of a user account’s properties, or in Group Policy.)
You can also use the Shadow command-line tool to control an active session of another user on a terminal server remotely.
To
control another user’s session remotely, you must be assigned the Full
Control or Remote Control special access permission on the server’s
RDP-Tcp connection.
Important: Using the Remote Control feature in TSM
You
must be connected to the terminal server in a client session to use the
Remote Control feature in TSM. The feature is disabled in TSM when you
are logged on locally to the terminal server in a console session.
Reset
Resetting a Terminal Services session deletes that session immediately
without saving any session data. Reset a session only when it appears
to have stopped responding.
You can also use the Rwinsta or Reset session command-line command to reset a user session on a terminal server.
Resetting another user’s TS session requires the Full Control access permission on the server’s RDP-Tcp connection.
Status When you right-click a user session shown on the Users tab and then select the Status
command from the shortcut menu, the Status dialog box appears,
containing additional status information about the session. This
information includes the TS client’s IP address, computer name, and
total bytes transmitted during the session. Figure 3 shows such a status dialog box.
To
view the status of another user’s session, you must be granted the Full
Control or Query Information special access permission on the server’s
RDP-Tcp connection.
Log Off
Logging off a user ends all user processes and then deletes the session
from the terminal server. If you want to log off a user, send the user
a message first. Otherwise, the user could lose unsaved session data.
Besides using TSM to log off a user, you can also use the Logoff
command-line command. To log off another user from a session, you must
have the Full Control permission on the server’s RDP-Tcp connection.
Ending a TS User Session Process
You
can use the Processes tab in TSM to force a particular process in a
user session to close. This might be necessary, for example, if a
certain application is hanging in a user session and is causing a
screen freeze. To end a process for this reason or any other, simply
right-click the process in question, and then click End, as shown in Figure 4.
To end a process within a terminal services user session, you can also use the Tskill command-line command.
Managing Resources in Client Sessions
You
can use the Windows Server Resource Manager (WSRM) feature in Windows
Server 2008 to ensure that each client connecting to a terminal server
is granted equal access to the server’s resources. To use WSRM, you
must first install it by opening Server Manager, selecting the Features
node, and then clicking Add Features. You can then use the Add Features
Wizard to select the feature and proceed with the installation. Once
the tool is installed, you can access WSRM through Administrative Tools.
WSRM
uses Resource Allocation Policies to determine how computer resources
are allocated to processes running on the computer. At any given time,
only one Resource Allocation Policy is considered the managing policy or the policy in effect.
Four
Resource Allocation Policies are built into WSRM, and two are
specifically designed for computers running Terminal Services:
Equal_Per_User
When this policy is set as the managing policy, available CPU bandwidth
is shared equally among users. For example, if two users are running
multiple applications that consume 100 percent of the allocated CPU
bandwidth, WSRM will lower the priority of processes run by the user
who exceeds 50 percent CPU usage. In this policy, the number of
terminal services sessions owned by each user is not considered.
Equal_Per_Session
If you implement the Equal_Per_Session resource-allocation policy, each
user session (and its associated processes) gets an equal share of the
CPU resources on the computer. For example, if two users each own two
separate user sessions on a terminal server and consume 100 percent of
the allocated CPU bandwidth, WSRM will lower the priority of the
processes run in the terminal services session that exceeds 25 percent
CPU usage.
In
general, you can think of these built-in Resource Allocation Policies
in WSRM as a simple means to ensure that no single user or session
consumes more than an equal share of the server’s available resources.
However, you can also use WSRM to create custom Resource Allocation
Policies. When you create custom Resource Allocation Policies, you
define Process Matching Criteria
that specify services, processes, or applications on the local server.
In the Resource Allocation Policy, you can then allocate a certain
amount of CPU or memory resources to those chosen services, processes,
or applications.